How do I delete a file called "nul"?
G'day all,
Here's a blast-from-the-past question.
I have a file on my Win7 Ultimate x64 filesystem called "nul". It's a hangover from installing Cygwin. But now I can't seem to delete it!
In Windows Explorer, I get
Ditto for CMD.EXE, DOpus V9, Take Command, and in PowerShell, I get :
PS C:\Users\Pete> cd C:\cygwin\dev
PS C:\cygwin\dev> dir
Directory: C:\cygwin\dev
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 1/01/1601 11:00 AM 0 nul
PS C:\cygwin\dev> del nul
Remove-Item : Cannot find path 'C:\cygwin\dev\nul' because it does not exist.
At line:1 char:4
+ del <<<< nul
+ CategoryInfo : ObjectNotFound: (C:\cygwin\dev\nul:String) [Remove-Item], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
PS C:\cygwin\dev>
Obviously, there are any number of high-powered tools I can use to remove the file, but I wanted to see if there's a simpler way that doesn't cause W7 to trip up over it's MSDOS heritage?
Any suggestions or comments?
Thanks in advance,
Pete
July 9th, 2012 8:13pm
Hey Pete,
Give this a shot try opening up command prompt and insert this string, just input the appropriate directory.
DEL \\.\c:\somedir\nul
Adam
Free Windows Admin Tool Kit Click here and download it now
July 9th, 2012 10:21pm
Brilliant, Adam! That worked perfectly. Interestingly, it didn't work in Powershell, but it did in Take Command. I didn't get to check cmd.exe.
Anyway, that's a terrific tool to have. Thanks very much, you made my day!
-Pete
July 10th, 2012 3:23am